package com.qianfeng.controller;

import com.qianfeng.entity.User;
import com.qianfeng.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@Controller()
public class UserController {
@Autowired
private UserService service;

    @RequestMapping(value = "ak")
    public String ak(Integer id, Map map){
        System.out.println("进来了");

        User one = service.getOne(1);
        System.out.println(one);
        map.put("user",one);
        return "/user";

    }
  /*  @ResponseBody
    @RequestMapping("/hi")
    public String hi(HttpServletRequest request, HttpServletResponse response,String name){
        System.out.println(name);
        *//*response.setHeader("Access-Control-Allow-Origin","true");*//*
        return "wo";
    }

*/
  @ResponseBody
  @RequestMapping(value = "/hi",method = RequestMethod.POST)
  public String hi(String name){
      System.out.println(name);
      /*response.setHeader("Access-Control-Allow-Origin","true");*/
      return "wo";
  }


}
